<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jQuery-jsonp</title>
    <style>
        #result{
            width: 300px;
            height: 100px;
            border: solid 2px #0f0;
        }
    </style>
    <script crossorigin="anonymous" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
    <button>点我发送 jsonp 请求</button>
    <div id="result">

    </div>
    <script>
        $('button').eq(0).click(function(){
            $('button').eq(0).click(function(){
                $.getJSON('http://127.0.0.1:8000/jquery-jsonp-server?callback=?', function(data){
                    // console.log(data);
                    $('#result').html(`
                        名称： ${data.name},<br>
                        address: ${data.city}
                    `)
                })
            })
        });
    </script>
</body>
</html>